home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_b / nulife.act < prev    next >
Text File  |  1995-04-22  |  4KB  |  2 lines

  1. MODULE¢¢BYTE ARRAY disp(800), work(800)¢CARD px, lptr¢INT  base=[40], xptr, yptr, cntr, x, y¢BYTE none=[0], live=[1], born=[3], ¢     dead=[2], temp, py, inp¢                      ¢INCLUDE "D:SYS.ACT"¢¢PROC Banner ()¢¢CHAR ans¢¢Graphics (0)¢Poke (1016,1)¢Poke (710,$C3)¢Position (2,3)¢PrintE ("   New Life 1.0  (Life revisited)")¢PrintE ("   Copyright (c) 1986 by Dan Rhea")¢PrintE ("This program is in the Public Domain")¢Position (0,9)     ¢PrintE (" This Program Was Written Using ACTION!")¢PrintE ("     ACTION!  is a Trademark of ")¢PrintE ("      Action Computer Services")¢PrintE (" ")¢PrintE ("    Portions of this program are")¢PrintE ("     Copyright (c) 1984,  A.C.S")¢Position (0,22)¢Print ("           פσ⌠⌡≥∈ to continue")¢InputS (ans)¢¢RETURN¢¢PROC Look()¢¢cntr=0¢IF x>0 THEN¢   cntr=cntr+work(lptr-1) ; W¢FI¢IF x>0 AND y>0 THEN¢   cntr=cntr+work(lptr-1-base) ; NW¢FI¢IF y>0 THEN¢   cntr=cntr+work(lptr-base) ; N¢FI¢IF x<39 AND y>0 THEN¢   cntr=cntr+work(lptr+1-base) ; NE¢FI¢IF x<39 THEN¢   cntr=cntr+work(lptr+1) ; E¢FI¢IF x<39 AND y<19 THEN¢   cntr=cntr+work(lptr+1+base) ; SE¢FI¢IF y<19 THEN¢   cntr=cntr+work(lptr+base) ; S¢FI¢IF x>0 AND y<19 THEN¢   cntr=cntr+work(lptr-1+base) ; SW¢FI¢IF cntr=2 THEN ; Life¢   IF work(lptr)=live THEN¢      disp(lptr)=live¢   ELSE¢      disp(lptr)=none¢   FI¢ELSEIF cntr=3 THEN ; Birth¢   IF work(lptr)=live THEN¢      disp(lptr)=live¢   ELSE¢      disp(lptr)=born¢   FI¢ELSE ; Death¢   IF work(lptr)=live THEN¢      disp(lptr)=dead¢   ELSE¢      disp(lptr)=none¢   FI¢FI¢¢RETURN¢¢PROC Init()¢¢Graphics (0)¢Poke (710,$C3)¢PrintE (" ")¢PrintE ("✓⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤⑤
  2. ")¢PrintE ("Ö                                 ⑨")¢PrintE ("Ö áááמσ≈áכΘµσáõ«ãááΓ∙áגβ∈áפΦσβááá ⑨")¢PrintE ("Ö                                 ⑨")¢PrintE ("èòòòòòòòòòòòòòòòòòòòòòòòòòòòòòòòòòê")¢PrintE (" ")¢PrintE (" ")¢PrintE (" This is basicly your standard Life")¢PrintE (" program except that this one will ")¢PrintE (" show births in green and deaths   ")¢PrintE (" in red. The empty cells are the   ")¢PrintE (" black ones and the live cells are ")¢PrintE (" yellow. The initial groth will be ")¢PrintE (" random. But you have some control ")¢PrintE (" over distribution by giving each  ")¢PrintE (" cell a 50% chance (1) to less     ")¢PrintE (" than 10% (9) by selecting 1-9 for ")¢PrintE (" the cell distribution.            ")¢DO   ¢   Position (2,22)¢   Print (" Enter 1 to 9 for Distribution :")¢   inp=InputB()¢   IF inp<10 AND inp>0 THEN EXIT FI¢OD   ¢RETURN¢¢PROC Plop ()¢¢px=x py=y¢Plot(px,py)¢¢RETURN¢¢PROC Main()¢¢Banner()¢DO¢Init()¢Graphics (3)¢Poke (708,$DA) ; Yellow¢Poke (709,$34) ; Red¢Poke (710,$C6) ; Green¢Poke (752,1)           ¢PrintE ("Commands: צ⌠β≥⌠ to re-run program")¢PrintE (" You must צσ∮σπ⌠ to freeze screen")¢Print  (" hold key נ≡⌠Θ∩∈ to exit program")¢FOR yptr=0 TO 19 DO¢    FOR xptr=0 TO 39 DO¢        lptr=yptr*base ¢        lptr=lptr+xptr¢        temp=Rand(inp+1)¢        IF temp=1 THEN¢           disp(lptr)=live¢           work(lptr)=live¢        ELSE¢           disp(lptr)=none¢           work(lptr)=none¢        FI¢        color=disp(lptr)¢        x=xptr y=yptr¢        Plop ()¢    OD¢OD¢DO¢   FOR yptr=0 TO 19 DO¢      FOR xptr=0 TO 39 DO¢         lptr=yptr*base ¢         lptr=lptr+xptr¢         y=yptr x=xptr¢         Look ()¢         color=disp(lptr)¢         Plop ()¢      OD¢   OD¢   FOR lptr=0 TO 800 DO¢      IF disp(lptr)=dead THEN¢         work(lptr)=none¢      ELSEIF disp(lptr)=born THEN¢         work(lptr)=live¢      ELSE¢         work(lptr)=disp(lptr)¢      FI¢      disp(lptr)=work(lptr)¢   OD¢   FOR yptr=0 TO 19 DO¢      FOR xptr=0 TO 39 DO¢         lptr=yptr*base ¢         lptr=lptr+xptr¢         color=disp(lptr)¢         y=yptr x=xptr¢         Plop ()¢      OD¢   OD¢   IF Peek(53279)=5 THEN¢      DO UNTIL Peek(53279)=7 OD¢   FI¢   IF Peek(53279)=6 THEN¢      DO UNTIL Peek(53279)=7 OD¢      EXIT¢   FI¢   IF Peek(53279)=3 THEN¢      DO UNTIL Peek(53279)=7 OD¢      inp=99¢      EXIT¢   FI¢OD¢IF inp=99 THEN EXIT FI¢OD¢Break()¢::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::